package com.group.three.service.Impl;

import com.github.pagehelper.PageHelper;
import com.group.three.entity.OrderDetailVO;
import com.group.three.entity.OrderLog;
import com.group.three.entity.OrderSimpleVO;
import com.group.three.mapper.OrderMapper;
import com.group.three.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;

    @Override
    public List<OrderSimpleVO> queryByParams(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return orderMapper.queryByParams(pageNum, pageSize);
    }

    @Override
    public List<OrderDetailVO> getBySn(String orderSn) {
        return orderMapper.getBySn(orderSn);
    }

    @Override
    public int updatePrice(String orderSn, Double orderPrice) {
        return orderMapper.updatePrice(orderSn, orderPrice);
    }

    @Override
    public int cancelOrder(String orderSn, String reason) {
        return orderMapper.cancelOrder(orderSn, reason);
    }

    @Override
    public int updateMemberAddress(String orderSn, String name, String mobile, String address) {
        return orderMapper.updateMemberAddress(orderSn, name, mobile, address);
    }

    @Override
    public List<OrderLog> selectBuyerOrderItemLog(String orderSn) {
        return orderMapper.selectBuyerOrderItemLog(orderSn);
    }

    @Override
    public int delivery(String orderSn, String logisticsNo, String logisticsId) {
        return orderMapper.delivery(orderSn, logisticsNo, logisticsId);
    }
}
